/* Kanvas Paint and Drawing Tool.
 * Copyright (C) 2011 Darryl Wallace
 * wallacdj@gmail.com / darryl@wallynet.ca
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PLUGINMANAGER_H
#define PLUGINMANAGER_H

#include <QtCore>
#include <QtGui>
#include "../PluginInterface/IPlugin.h"
#include "../PluginInterface/ITool.h"
#include "../PluginInterface/IFilter.h"
#include "../PluginInterface/KanvasPluginInterface.h"

class TreeItem;

/// The plugin manager will be used in a QTreeview for a summary
class PluginManager : public QAbstractItemModel
{
    Q_OBJECT

public:
    PluginManager(QObject *parent =0);
    ~PluginManager();

     QVariant data(const QModelIndex &index, int role) const;
     Qt::ItemFlags flags(const QModelIndex &index) const;
     QVariant headerData(int section, Qt::Orientation orientation,
                         int role = Qt::DisplayRole) const;
     QModelIndex index(int row, int column,
                       const QModelIndex &parent = QModelIndex()) const;
     QModelIndex parent(const QModelIndex &index) const;
     int rowCount(const QModelIndex &parent = QModelIndex()) const;
     int columnCount(const QModelIndex &parent = QModelIndex()) const;

     bool addPlugin(QObject *plugin);
     QStringList toolNames() const;

     const QList<ITool *>  &tools() const {return _tools;}


private:
     TreeItem *_rootItem;
     QList<KanvasPluginInterface *> _plugins;
     QList<ITool *> _tools;
     QList<IFilter *> _filters;
};

#endif // PLUGINMANAGER_H
